package com.scheduling.inventory.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * 原料库存实体
 *
 * @author 开发团队
 * @since 2025-05-29
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("material_inventory")
@Schema(description = "原料库存")
public class MaterialInventory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 库存ID
     */
    @TableId(value = "inventory_id", type = IdType.ASSIGN_ID)
    @Schema(description = "库存ID")
    private String inventoryId;

    /**
     * 原料ID
     */
    @TableField("material_id")
    @Schema(description = "原料ID")
    private String materialId;

    /**
     * 库存数量
     */
    @TableField("quantity")
    @Schema(description = "库存数量")
    private BigDecimal quantity;

    /**
     * 单位
     */
    @TableField("unit")
    @Schema(description = "单位")
    private String unit;

    /**
     * 最后更新时间
     */
    @TableField("last_update")
    @Schema(description = "最后更新时间")
    private LocalDateTime lastUpdate;

    // ========== 关联字段 ==========

    /**
     * 原料名称（关联查询）
     */
    @TableField(exist = false)
    @Schema(description = "原料名称")
    private String materialName;

    /**
     * 原料描述（关联查询）
     */
    @TableField(exist = false)
    @Schema(description = "原料描述")
    private String materialDescription;

    /**
     * 安全库存（关联查询）
     */
    @TableField(exist = false)
    @Schema(description = "安全库存")
    private BigDecimal safetyStock;

    /**
     * 是否库存不足（计算字段）
     */
    @TableField(exist = false)
    @Schema(description = "是否库存不足")
    private Boolean isLowStock;
} 